﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NLog.Config;
using System.Web;

namespace EF4.Core.Logger
{
    public class DefaultLogger : ILogger
    {
        private NLog.Logger logger;
        public DefaultLogger()
        {
            logger = GetInsance();
        }
        private NLog.Logger GetInsance() {
            string path = HttpContext.Current.Server.MapPath("~/nlog.config");
            NLog.Config.XmlLoggingConfiguration conf = new XmlLoggingConfiguration(path);
            NLog.LogManager.ThrowExceptions = true;
            NLog.LogManager.Configuration = conf;
            return NLog.LogManager.GetCurrentClassLogger();
        }
        public void Debug(string message)
        {
             NLog.Logger logger = NLog.LogManager.GetLogger("*");
            logger.Debug(message);
        }
        public void Info(string message)
        {
            
            logger.Info(message);
            logger.Error(message);
            
        }
        public void Error(string message)
        {
            logger.Error(message);
        }
    }
}

